/* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/
USE DBUCN
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
GO
CREATE TABLE dbo.TBTurmaAluno
	(
	id int NOT NULL IDENTITY (1, 1),
	idAluno int NOT NULL,
	idTurma int NOT NULL
	)  ON [PRIMARY]
GO
ALTER TABLE dbo.TBTurmaAluno ADD CONSTRAINT
	PK_TBTurmaAluno PRIMARY KEY CLUSTERED 
	(
	id
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
ALTER TABLE dbo.TBTurmaAluno SET (LOCK_ESCALATION = TABLE)
GO
ALTER TABLE dbo.TBAluno SET (LOCK_ESCALATION = TABLE)
GO
COMMIT
BEGIN TRANSACTION
GO
ALTER TABLE dbo.TBTurmaAluno ADD CONSTRAINT
	FK_TBTurmaAluno_TBAluno FOREIGN KEY
	(
	idAluno
	) REFERENCES dbo.TBAluno
	(
	ID
	) ON UPDATE  NO ACTION 
	 ON DELETE  NO ACTION 
	
GO
ALTER TABLE dbo.TBTurmaAluno ADD CONSTRAINT
	FK_TBTurmaAluno_TBTurma FOREIGN KEY
	(
	idTurma
	) REFERENCES dbo.TBTurma
	(
	ID
	) ON UPDATE  NO ACTION 
	 ON DELETE  NO ACTION 
	
GO
ALTER TABLE dbo.TBTurmaAluno SET (LOCK_ESCALATION = TABLE)
GO
COMMIT







